/*
* 先进后出 后进先出 连续
* */

class Stack {
  constructor() {
    this.stack = [];
  }

  toString() {
    return this.stack.join(',');
  }
  push(val) {
    return this.stack.push(val);
  }

  pop() {
    return this.stack.pop();
  }

  size() {
    return this.stack.length;
  }
}


let stack = new Stack();
stack.push(1);
stack.push(2);
stack.push(3);
console.log(stack.toString());
stack.pop();
console.log(stack.toString());
console.log(stack.size());

